package com.example.springinterceptersample.interceptor

import org.springframework.context.annotation.Configuration
import org.springframework.web.servlet.config.annotation.InterceptorRegistry
import org.springframework.web.servlet.config.annotation.WebMvcConfigurationSupport

@Configuration
class WebMvcInterceptorConfig: WebMvcConfigurationSupport() {
    override fun addInterceptors(registry: InterceptorRegistry) {
//        registry.addInterceptor(MyInterceptor())//注册拦截器拦截接口调用

        registry.addInterceptor(MyInterceptor()).excludePathPatterns("/getAllCar")//这里可以指定getAllCar方法不会备拦截
        super.addInterceptors(registry)

    }
}